全部文档

9.4查询命令管理

提供对于命令的各种信息的查询功能。

9.4.1查询异步命令的详情

功能描述:获取设备异步命令列队中的指定命令。返回字段中的result字段表示该命令的执行状态,对应的值,0:wait (等待中); 3 : succeed(成功) ;4 :failed(失败)。当命令执行成功后,value字段返回改命令的执行值。

GET /api/v1/commands-async/{commandId}

Path:

Name Type Description Required
commandId string 命令ID Yes

cURL example:

curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/commands-async/b53dad57-577c-4a14-a0ed-03a72cbe59ad?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}' \
--header 'platform: 3' \
--header 'projectId: {projectId}'

Response data:

Name Type Description
commandId string 命令ID
groupId int 分组ID
batchId string 批次ID
productId int 产品ID
deviceId int 设备ID
deviceName string 设备名称
cmdType string 命令类型:propertySet或propertyGet或propertyExecute
protocol int 协议(1:MQTT / 2:LWM2M / 3:TCP / 4:Modbus / 5:OPC UA)
identifier string 属性名称
value object 属性值
created long 创建时间
modified long 更新时间
result int 命令执行结果:0-等待,3-成功,4-失败
msg string 错误信息
devRespCode string 设备返回的错误码
devRespMsg string 设备返回的错误信息

Response example:

{
  "success": true,
  "code": 0,
  "msg": "",
    "data": {
        "eventId": null,
        "deviceId": 10000196,
        "productId": 100316,
        "protocol": 4,
        "name": null,
        "value": 1,
        "created": 1574237516859,
        "origin": null,
        "result": 3,
        "modified": 1574237517022,
        "identifier": "led_light",
        "cmdType": "propertySet",
        "deviceName": "MODBUD_D_1",
        "msg": "",
        "comandId": null
    },
}

9.4.2分页查询设备异步命令

功能描述:分页查询设备异步命令,返回具体分页信息和命令信息列表。

GET /api/v1/commands-async

Query

Name Type Description Required
deviceId int 设备ID Yes
start int 起始时间戳(毫秒级时间戳) No
end int 结束时间戳(毫秒级时间戳) No
identifier string 设备属性 No
pageSize int 分页大小 Yes
currentPage int 页码 Yes

cURL example:

curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/commands-async?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}&deviceId=100001&pageSize=10&currentPage=1' \
--header 'platform: 3' \
--header 'projectId: {projectId}'

Response data:

Name Type Description
currentPage int 当前页码
pageSize int 每页条数
totalCount long 总条数
totalPage int 总页数
content struct[] 当前页内容

Response data content的子对象结构体:

Name Type Description
commandId string 命令ID
groupId int 分组ID
batchId string 批次ID
productId int 产品ID
deviceId int 设备ID
deviceName string 设备名称
cmdType string 命令类型:propertySet或propertyGet或propertyExecute
protocol int 协议(1:MQTT / 2:LWM2M / 3:TCP / 4:Modbus / 5:OPC UA)
identifier string 属性名称
value object 属性值
created long 创建时间
modified long 更新时间
result int 命令执行结果:0-等待,3-成功,4-失败
msg string 错误信息
devRespCode string 设备返回的错误码
devRespMsg string 设备返回的错误信息

Response example:

{
  "success": true,
  "code": 0,
  "msg": "",
  "data": {
    "totalCount": 1,
    "pageSize": 5,
    "currentPage": 1,
    "totalPage": 1,
    "content": [
      {
        "id": "5d5154dea9ab4f00012472a6",
        "type": 1
        "deviceId": 10000115,
        "propertyName": "string",
        "value": "50",
        "retry": 0,
        "executeCount": 0,
        "expiredTime": 100000000,
        "createTime": 1565611230481,
        "sendStatus": 0
      }
    ]
  }
}

9.4.3查询设备最新一条异步命令

功能描述:分页查询设备最新一条异步命令信息。

GET /api/v1/commands-async/{deviceId}/last

Path

Name Type Description Required
deviceId int 设备ID Yes

cURL example:

curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/commands-async/123/last?accessKeyId={accessKeyId}&signatureNonce=166&signature={signature}&deviceId=100001&pageSize=10&currentPage=1' \
--header 'platform: 3' \
--header 'projectId: {projectId}'

Response data:

Name Type Description
commandId string 命令ID
groupId int 分组ID
batchId string 批次ID
productId int 产品ID
deviceId int 设备ID
deviceName string 设备名称
cmdType string 命令类型:propertySet或propertyGet或propertyExecute
protocol int 协议(1:MQTT / 4:Modbus / 5:OPC UA)
identifier string 属性名称
value object 属性值
created long 创建时间
modified long 更新时间
result int 命令执行结果:0-等待,3-成功,4-失败
msg string 错误信息
devRespCode string 设备返回的错误码
devRespMsg string 设备返回的错误信息

Response example:

{
  "success": true,
  "code": 0,
  "msg": "",
  "data": {
        "id": "5d5154dea9ab4f00012472a6",
        "type": 1
        "deviceId": 10000115,
        "propertyName": "string",
        "value": "50",
        "retry": 0,
        "executeCount": 0,
        "expiredTime": 100000000,
        "createTime": 1565611230481,
        "sendStatus": 0
      }
}

results matching ""

    No results matching ""